﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Novell.DirectoryServices.Linq
{

    /// <summary>
    /// Specifies the underlying attribute to query for in the directory.
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments"), AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public sealed class DirectoryAttributeAttribute : Attribute
    {
        #region Constructors

        /// <summary>
        /// Creates a new attribute binding attribute for a entity class field or property.
        /// </summary>
        /// <param name="attribute">Name of the attribute to query for.</param>
        public DirectoryAttributeAttribute(string attribute)
        {
            Attribute = attribute;

        }



        /// <summary>
        /// Creates a new attribute binding attribute for a entity class field or property.
        /// </summary>
        /// <param name="attribute">Name of the attribute to query for.</param>
        /// <param name="defaultNamingAttribute">Specifies if this attribute is the one used when creating the RDN.</param>
        public DirectoryAttributeAttribute(string attribute, bool defaultNamingAttribute)
        {
            Attribute = attribute;
            DefaultNamingAttribute = defaultNamingAttribute;
        }


        #endregion

        #region Properties

        /// <summary>
        /// Name of the attribute to query for.
        /// </summary>
        public string Attribute { get; private set; }

        /// <summary>
        /// Specifies if this attribute is the one that is used when creating a new item.
        /// </summary>
        public bool DefaultNamingAttribute { get; private set; }
        #endregion
    }
}
